<%@page import="cn.school.entity.Student"%>
<%@page import="java.io.File"%>
<%@page import="cn.school.service.Service"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String stuno=request.getParameter("stuno");
int stuno1 = Integer.parseInt(stuno);

Service s=new Service();
Student s1=s.getOne(stuno1);
/* String path=s1.getIdcardpic(); */
/* application.getRealPath("img"); */
/* File file=new File(application.getRealPath("img")); */
File path=new File(application.getRealPath("img"));
File file=new File(path,s1.getIdcardpic());
boolean i=file.delete();
/* if(i==true){
	out.println("<script>alert('删除成功');location.replace('updateStu.jsp');</script>");
}else{
	out.println("<script>alert('删除失败');location.replace('updateStu.jsp');</script>");
} */
int r=s.deleteByStuId(stuno1);

if(r>0){
	out.println("<script>alert('删除成功');location.replace('updateStu.jsp');</script>");
}else{
	out.println("<script>alert('删除失败');location.replace('updateStu.jsp');</script>");
}
%>
</body>
</html>